from Base import message, intersect, SS_VALID
from DRG import MDCY_DRG

def group(record):
  adrg_zd = ["R75.x00x001","Z21.x00x001"]
  adrg_zd1 = []
  adrg_ss = []
  adrg_ss1 = []
  dept_list = []

  if True and intersect(record.zdList, adrg_zd) and (not record.ssList or not intersect(record.ssList[0],SS_VALID)):
    message('符合YR2入组条件，匹配规则：主要诊断或其他诊断匹配')

    if MDCY_DRG.YR21_group(record):
      return 'YR21'

    if MDCY_DRG.YR25_group(record):
      return 'YR25'
        
    return 'YR2'
  else:
    return ''
    
